import { createRouter, createWebHashHistory } from "vue-router"
import IndexA from "../pages/IndexA.vue";
import Film from "../pages/Film.vue"
import IndexB from "../pages/IndexB.vue";
import IndexC from "../pages/IndexC.vue";
import IndexD from "../pages/IndexD.vue";
import IndexE from "../pages/IndexE.vue";
import IndexF from "../pages/IndexF.vue";
import IndexG from "../pages/IndexG.vue";
import Payment from "../pages/Payment.vue";
import User from "../pages/User.vue";
import System from "../pages/System.vue";

const router = createRouter({
    history: createWebHashHistory(),
    routes: [//路由表
        { path: '/', redirect: "/indexa" },
        { path: '/indexa', component: IndexA, meta: { title: ' 电影信息展示' } },
        { path: '/film/:id/:type', name: 'film', component: Film, meta: { title: '影片详情' }, props: true },
        { path: '/indexb', component: IndexB, meta: { title: '影院信息' } },
        { path: '/indexc', component: IndexC, meta: { title: '选座购票' } },
        { path: '/purchase', name: "purchase", component: () => import('../pages/Purchase/Purchase.vue'), meta: { title: '选座购票' } },
        { path: '/indexd', component: IndexD, meta: { title: ' 订单管理' } },
        { path: '/indexe', component: IndexE, meta: { title: '营销活动' } },
        { path: '/indexf', component: IndexF, meta: { title: '客服与反馈' } },
        { path: '/indexg', component: IndexG, meta: { title: ' 数据统计与分析' } },
        { path: '/payment', component: Payment, meta: { title: '支付模块' } },
        { path: '/user', component: User, meta: { title: '用户' } },
        { path: '/system', component: System, meta: { title: '系统管理' } },
        { path: '/:match(.*)*', component: () => import('../components/404.vue') },//处理找不到或者错误组件
    ],
    linkActiveClass: 'active'//路由响应时的样式
})
router.beforeEach((to, from, next) => {
    document.title = to.meta.title;
    next()
})
export default router